/**
 * 
 */
package com.guchenbo.example.thread;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Cre.Gu
 *
 */
public class CacheTest2 {

	private volatile OneValueCache cache = new OneValueCache(null, null);
	
	public void service(String key,String value2){
		String value = cache.get(key);
		if(value == null){
			System.out.println("not contains");
			
			cache = new OneValueCache(key, value2);
		}else{
			System.out.println("contains");
		}
		
	}
	
	public static void main(String[] args) {
		final CacheTest2 t = new CacheTest2();
		for (int i = 0; i < 10; i++) {
			new Thread(new Runnable() {
				@Override
				public void run() {
					t.service("6","");
				}
			}).start();
		}
	}
}
